﻿CREATE TABLE [PR].[DeleteLog] (
    [Id]           INT           NOT NULL,
    [DepartmentId] AS            ([Id]/(100000000)),
    [TableName]    VARCHAR (50)  NOT NULL,
    [IdValue]      INT           NOT NULL,
    [NotFound]     BIT           NOT NULL,
    [Deleted]      BIT           NOT NULL,
    [RejectReason] VARCHAR (250) NULL,
    [Note]         VARCHAR (250) NULL,
    [MD]           DATETIME      NOT NULL,
    [MW]           VARCHAR (50)  NOT NULL,
    CONSTRAINT [PK_PR.DeleteLog] PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Код подразделения, где была предпринята попытка удаления записи', @level0type = N'SCHEMA', @level0name = N'PR', @level1type = N'TABLE', @level1name = N'DeleteLog', @level2type = N'COLUMN', @level2name = N'DepartmentId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Наменование таблицы', @level0type = N'SCHEMA', @level0name = N'PR', @level1type = N'TABLE', @level1name = N'DeleteLog', @level2type = N'COLUMN', @level2name = N'TableName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Значение идентификатора удаляемой записи', @level0type = N'SCHEMA', @level0name = N'PR', @level1type = N'TABLE', @level1name = N'DeleteLog', @level2type = N'COLUMN', @level2name = N'IdValue';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'=1 - удаляемая запись не найдена в БД', @level0type = N'SCHEMA', @level0name = N'PR', @level1type = N'TABLE', @level1name = N'DeleteLog', @level2type = N'COLUMN', @level2name = N'NotFound';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Запись удалена', @level0type = N'SCHEMA', @level0name = N'PR', @level1type = N'TABLE', @level1name = N'DeleteLog', @level2type = N'COLUMN', @level2name = N'Deleted';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Причина, по которой запись не удалена', @level0type = N'SCHEMA', @level0name = N'PR', @level1type = N'TABLE', @level1name = N'DeleteLog', @level2type = N'COLUMN', @level2name = N'RejectReason';

